package 蓝桥.十四届;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

/**
 * @author ZhuYi
 * @create 2025/3/18 13:49
 */
public class D矩形总面积 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] s = br.readLine().split(" ");
        int x1, y1, x2, y2, x3, y3, x4, y4;
        x1 = Integer.parseInt(s[0]);
        y1 = Integer.parseInt(s[1]);
        x2 = Integer.parseInt(s[2]);
        y2 = Integer.parseInt(s[3]);
        x3 = Integer.parseInt(s[4]);
        y3 = Integer.parseInt(s[5]);
        x4 = Integer.parseInt(s[6]);
        y4 = Integer.parseInt(s[7]);
        int width = Math.max(0, Math.min(x2, x4) - Math.max(x1, x3));
        int height = Math.max(0, Math.min(y2, y4) - Math.max(y1, y3));
        Long area = (long) ((y2 - y1) * (x2 - x1) + (y4 - y3) * (x4 - x3));
        if (width > 0 && height > 0) {
            area -= (long)(width * height);
        }
        System.out.println(area);
    }
}
